import {ChangeDetectorRef, Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {JidihttpProvider} from "../../providers/jidihttp/jidihttp";
import {TabsPage} from "../tabs/tabs";

/**
 * Generated class for the LoginPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */
@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage {
  username_login:string;
  pws:string;
  constructor(public navCtrl: NavController, public navParams: NavParams,public jidiProvider:JidihttpProvider,public cdchange:ChangeDetectorRef) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad LoginPage');
  }



  /**weixin login **/
  dengluEvent(){
    var params = {
      "username": this.username_login,
      "password": this.pws
    };
    //alert(params);
    this.jidiProvider.userLoginHome(params).subscribe(data => {
      if(data['success']){
        this.navCtrl.setRoot(TabsPage);
      }else{
        alert(data['message']);
      }



    },error => {

    });

  }


}
